Filter hook 'edit_post_{$field}'

in WP Core File wp-includes/post.php at line 3028

View Source

edit_post_{$field}

Filter Hook
Description
Filters the value of a specific post field to edit. Only applied to post fields not prefixed with `post_`. The dynamic portion of the hook name, `$field`, refers to the post field name. Possible filter names include: - `edit_post_ID` - `edit_post_ping_status` - `edit_post_pinged` - `edit_post_to_ping` - `edit_post_comment_count` - `edit_post_comment_status` - `edit_post_guid` - `edit_post_menu_order`

Hook Information

File Location wp-includes/post.php View on GitHub
Hook Type Filter
Line Number 3028

Hook Parameters

Type Name Description
mixed $value Value of the post field.
int $post_id Post ID.

Usage Examples

Basic Usage
<?php
// Hook into edit_post_{$field}
add_filter('edit_post_{$field}', 'my_custom_filter', 10, 2);

function my_custom_filter($value, $post_id) {
    // Your custom filtering logic here
    return $value;
}

Source Code Context

wp-includes/post.php:3028 - How this hook is used in WordPress core
<?php
3023  			 * @since 2.3.0
3024  			 *
3025  			 * @param mixed $value   Value of the post field.
3026  			 * @param int   $post_id Post ID.
3027  			 */
3028  			$value = apply_filters( "edit_post_{$field}", $value, $post_id );
3029  		}
3030  
3031  		if ( in_array( $field, $format_to_edit, true ) ) {
3032  			if ( 'post_content' === $field ) {
3033  				$value = format_to_edit( $value, user_can_richedit() );

PHP Documentation

<?php
/**
			 * Filters the value of a specific post field to edit.
			 *
			 * Only applied to post fields not prefixed with `post_`.
			 *
			 * The dynamic portion of the hook name, `$field`, refers to the
			 * post field name. Possible filter names include:
			 *
			 *  - `edit_post_ID`
			 *  - `edit_post_ping_status`
			 *  - `edit_post_pinged`
			 *  - `edit_post_to_ping`
			 *  - `edit_post_comment_count`
			 *  - `edit_post_comment_status`
			 *  - `edit_post_guid`
			 *  - `edit_post_menu_order`
			 *
			 * @since 2.3.0
			 *
			 * @param mixed $value   Value of the post field.
			 * @param int   $post_id Post ID.
			 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.